﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>RelayCommand</Title>
      <Author>Laurent Bugnion (GalaSoft)</Author>
      <Description>Creates and initializes a new RelayCommand with an Execute method and a CanExecute method. (V5.2.4.0)</Description>
      <HelpUrl>http://www.mvvmlight.net</HelpUrl>
      <Shortcut>mvvmrelaymethodcanexecute</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>attribute</ID>
          <ToolTip>Name of the attribute holding the RelayCommand.</ToolTip>
          <Default>_myCommand</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>commandname</ID>
          <ToolTip>Name of the RelayCommand.</ToolTip>
          <Default>MyCommand</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>canexecute</ID>
          <ToolTip>CanExecute delegate</ToolTip>
          <Default>true</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
      <Code Language="csharp"><![CDATA[private RelayCommand $attribute$;

        /// <summary>
        /// Gets the $commandname$.
        /// </summary>
        public RelayCommand $commandname$
        {
            get
            {
                return $attribute$ ?? ($attribute$ = new RelayCommand(
                    Execute$commandname$,
                    CanExecute$commandname$));
            }
        }

        private void Execute$commandname$()
        {
            $end$
        }

        private bool CanExecute$commandname$()
        {
            return true;
        }]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>